local sceneInstructions = dofile("instructions.lua")
local sceneScore = dofile("score.lua")
local sceneMenu = dofile("menu.lua")
local sceneGame = dofile("game.lua")

local moveToSceneInstructions = function(event) 
    director:moveToScene(sceneInstructions, {transitionType="slideInR", transitionTime=1.0})
end

local moveToSceneScore = function(event) 
   director:moveToScene(sceneScore, {transitionType="slideInR", transitionTime=1.0})
end

local moveToSceneGame = function(event) 
    director:moveToScene(sceneGame, {transitionType="slideInR", transitionTime=1.0})
end

local moveToSceneMenu = function(event) 
    director:moveToScene(sceneMenu, {transitionType="slideInL", transitionTime=1.0})
end

system:addEventListener("moveToSceneInstructions",moveToSceneInstructions)
system:addEventListener("moveToSceneScore",moveToSceneScore)
system:addEventListener("moveToSceneGame",moveToSceneGame)
system:addEventListener("moveToSceneMenu",moveToSceneMenu)

function hardKeyPressed(event)
	if event.phase == "released" then
		if event.keyCode == key.back then
			system:quit()
		end
	end
end
system:addEventListener("key", hardKeyPressed) 

director:moveToScene(sceneMenu) -- start with instantaneous change to scene1	